package com.jndv.phoneconfig;


import android.content.Context;

import com.chad.library.adapter.base.BaseQuickAdapter;
import com.chad.library.adapter.base.BaseViewHolder;

import java.util.List;

public class CategoryAdapter extends BaseQuickAdapter<String, BaseViewHolder> {

    int selectPos=0;
    Context context;

    public CategoryAdapter(Context context,int layoutResId, List<String> data) {
        super(layoutResId, data);
        this.context=context;
    }

    @Override
    protected void convert(BaseViewHolder holder, String item) {
        holder.setText(R.id.tv_name,item);
        if(holder.getLayoutPosition()==selectPos){
            holder.setTextColor(R.id.tv_name,context.getResources().getColor(R.color.red));
        }else {
            holder.setTextColor(R.id.tv_name,context.getResources().getColor(R.color.gray));
        }
    }

    public void setSelectPos(int pos){
        selectPos=pos;
    }
}
